<?php

namespace AppBundle\Doctrine;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Configuration;
use Doctrine\Common\EventManager;
use AppBundle\Util\Crypt\CryptUtil;

/**
 * Description of AppConnection
 *
 * @author yihao
 */
class AppConnection extends Connection
{
    
    public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
    {
        if (isset($params['password'])
                && ($pwd = CryptUtil::decrypt($params['password'])) !== false) {
            $params['password'] = $pwd;
        }
        
        parent::__construct($params, $driver, $config, $eventManager);
    }
    
}
